<!DOCTYPE html>
<html lang=zh>
<head>
    <meta charset="utf-8">
    

    <meta name="baidu-site-verification" content="lt822VnP06" />
    <meta name="baidu-site-verification" content="0Ajixw1Puk" />
    <meta name="google-site-verification" content="gCQD0Y6f0YlPTZTAjp_mqms4C7TlkMWrg3Xy0mFdMwI" />
    <title>Redis相关---Redis持久化(AOF&amp;Snapshot) | Giraffe&#39;s Home</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="恩，先说点题外话。上周被小虐了一丢丢,但有很大收获,了解了自己的不足,知道了自己还在哪些方面有欠缺。更坚定了一直以来的想法,应届生或者工作时间不长的人找工作公司规模，福利薪资都是浮云，跟对人才是最重要的,非常及其以及特别的重要,一个人好技术牛的部门leader绝对抵得上5K的薪资。这也完美解释了为何部门拆分,老大和磊哥走了之后这么不舒服,这尼玛相当于给我减了5K的工资啊,扯远了。。。。还是来看R">
<meta property="og:type" content="article">
<meta property="og:title" content="Redis相关---Redis持久化(AOF&Snapshot)">
<meta property="og:url" content="http://yemengying.com/2016/04/24/Redis-Persistence/index.html">
<meta property="og:site_name" content="Giraffe's Home">
<meta property="og:description" content="恩，先说点题外话。上周被小虐了一丢丢,但有很大收获,了解了自己的不足,知道了自己还在哪些方面有欠缺。更坚定了一直以来的想法,应届生或者工作时间不长的人找工作公司规模，福利薪资都是浮云，跟对人才是最重要的,非常及其以及特别的重要,一个人好技术牛的部门leader绝对抵得上5K的薪资。这也完美解释了为何部门拆分,老大和磊哥走了之后这么不舒服,这尼玛相当于给我减了5K的工资啊,扯远了。。。。还是来看R">
<meta property="og:image" content="http://yemengying.com/images/redis.png">
<meta property="og:updated_time" content="2018-12-13T08:04:59.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Redis相关---Redis持久化(AOF&Snapshot)">
<meta name="twitter:description" content="恩，先说点题外话。上周被小虐了一丢丢,但有很大收获,了解了自己的不足,知道了自己还在哪些方面有欠缺。更坚定了一直以来的想法,应届生或者工作时间不长的人找工作公司规模，福利薪资都是浮云，跟对人才是最重要的,非常及其以及特别的重要,一个人好技术牛的部门leader绝对抵得上5K的薪资。这也完美解释了为何部门拆分,老大和磊哥走了之后这么不舒服,这尼玛相当于给我减了5K的工资啊,扯远了。。。。还是来看R">
<meta name="twitter:image" content="http://yemengying.com/images/redis.png">
    

    

    
        <link rel="icon" href="https://yemengying.com/qiniu/image/image/favicon.png" />
    


    <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/lib/open-sans/styles.css">
    <link rel="stylesheet" href="/lib/source-code-pro/styles.css">

    <link rel="stylesheet" href="/css/style.css">

    <script src="/lib/jquery/2.1.3/jquery.min.js"></script>
    
    
        <link rel="stylesheet" href="/lib/fancybox/jquery.fancybox.css">
    
    
        <script type="text/javascript">
(function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-75861791-1', 'auto');
ga('send', 'pageview');

</script>
    
    
    
        <script>
var _hmt = _hmt || [];
(function() {
    var hm = document.createElement("script");
    hm.src = "//hm.baidu.com/hm.js?44bb8bfb1a576270255713e37746eb82";
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(hm, s);
})();
</script>

    

</head>
<body>
    <script src="//github.elemecdn.com/jiananshi/req/0.1.0/lib/req.js"></script>
    <script src="//npm.elemecdn.com/jinkela@1.2.18/umd.js"></script>
    <script src="//github.elemecdn.com/jiananshi/DisqusJS/2.0.8/index.js"></script>
    <div id="container">
        <header id="header">
    <div id="header-main" class="header-inner">
        <div class="outer">
            <a href="/" id="logo">
                <i class="logo"></i>
                <span class="site-title">Giraffe&#39;s Home</span>
            </a>
            <nav id="main-nav">
                
                    <a class="main-nav-link" href="/.">首页</a>
                
                    <a class="main-nav-link" href="/archives">归档</a>
                
                    <a class="main-nav-link" href="/categories">分类</a>
                
                    <a class="main-nav-link" href="/tags">标签</a>
                
                    <a class="main-nav-link" href="/about">关于</a>
                
                    <a class="main-nav-link" href="/message">留言</a>
                
                    <a class="main-nav-link" href="/friends">友链</a>
                
                    <a class="main-nav-link" href="/reading">正在读...</a>
                
            </nav>
            
                
                <nav id="sub-nav">
                    <div class="profile" id="profile-nav">
                        <a id="profile-anchor" href="javascript:;">
                            <img class="avatar" src="https://pic.yupoo.com/jiananshi/e85e4303/735cf286.jpeg" />
                            <i class="fa fa-caret-down"></i>
                        </a>
                    </div>
                </nav>
            
            <div id="search-form-wrap">

    <form class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
        <button type="submit" class="search-form-submit"></button>
    </form>
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="想要查找什么..." />
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
<script src="/js/insight.js"></script>

</div>
        </div>
    </div>
    <div id="main-nav-mobile" class="header-sub header-inner">
        <table class="menu outer">
            <tr>
                
                    <td><a class="main-nav-link" href="/.">首页</a></td>
                
                    <td><a class="main-nav-link" href="/archives">归档</a></td>
                
                    <td><a class="main-nav-link" href="/categories">分类</a></td>
                
                    <td><a class="main-nav-link" href="/tags">标签</a></td>
                
                    <td><a class="main-nav-link" href="/about">关于</a></td>
                
                    <td><a class="main-nav-link" href="/message">留言</a></td>
                
                    <td><a class="main-nav-link" href="/friends">友链</a></td>
                
                    <td><a class="main-nav-link" href="/reading">正在读...</a></td>
                
                <td>
                    
    <div class="search-form">
        <input type="text" class="ins-search-input search-form-input" placeholder="搜索" />
    </div>

                </td>
            </tr>
        </table>
    </div>
</header>

        <div class="outer">
            
                

<aside id="profile">
    <div class="inner profile-inner">
        <div class="base-info profile-block">
            <img id="avatar" src="https://pic.yupoo.com/jiananshi/e85e4303/735cf286.jpeg" />
            <h2 id="name">Giraffe</h2>
            <h3 id="title">Java Developer</h3>
            <span id="location"><i class="fa fa-map-marker"></i>Shanghai, China</span>
            <a id="follow" target="_blank" href="https://github.com/giraffe0813/">关注我</a>
        </div>
        <div class="article-info profile-block">
            <div class="article-info-block">
                56
                <span>文章</span>
            </div>
            <div class="article-info-block">
                36
                <span>标签</span>
            </div>
        </div>
        <div class="profile-block recent-comments">
            <p class="recent-comments-title">最新评论</p>
            <ul id="disqus-recent-comments" class="recent-comments-container">
            </ul>
        </div>
        
        <div class="profile-block social-links">
            <table>
                <tr>
                    
                    
                    <td>
                        <a href="http://github.com/giraffe0813" target="_blank" title="github" class=tooltip>
                            <i class="fa fa-github"></i>
                        </a>
                    </td>
                    
                    <td>
                        <a href="/atom.xml" target="_blank" title="rss" class=tooltip>
                            <i class="fa fa-rss"></i>
                        </a>
                    </td>
                    
                </tr>
            </table>
        </div>
        
    </div>
</aside>

            
            <section id="main"><article id="2016/04/24/Redis-Persistence/" class="article article-type-post" itemscope itemprop="blogPost">
    <div class="article-inner">
        
        
        
            <header class="article-header">
                
    
        <h1 class="article-title" itemprop="name">
            Redis相关---Redis持久化(AOF&amp;Snapshot)
        </h1>
    

                <div class="article-meta">
                    
    <div class="article-date">
        <i class="fa fa-calendar"></i>
        <a href="/2016/04/24/Redis-Persistence/">
            <time datetime="2016-04-24T07:09:18.000Z" itemprop="datePublished">2016-04-24</time>
        </a>
    </div>


                    
    <div class="article-category">
    	<i class="fa fa-folder"></i>
        <a class="article-category-link" href="/categories/redis/">redis</a>
    </div>

                    
    <div class="article-tag">
        <i class="fa fa-tag"></i>
        <a class="tag-link" href="/tags/redis/">redis</a>
    </div>

                </div>
            </header>
        
        <div class="article-entry" itemprop="articleBody">
        
            
                <div id="toc" class="toc-article">
                <strong class="toc-title">文章目录</strong>
                    <ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#AOF持久化"><span class="toc-number">1.</span> <span class="toc-text">AOF持久化</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#AOF可用配置"><span class="toc-number">1.1.</span> <span class="toc-text">AOF可用配置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#AOF优缺点"><span class="toc-number">1.2.</span> <span class="toc-text">AOF优缺点</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#AOF文件格式"><span class="toc-number">1.3.</span> <span class="toc-text">AOF文件格式</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#压缩AOF文件"><span class="toc-number">1.4.</span> <span class="toc-text">压缩AOF文件</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#快照持久化"><span class="toc-number">2.</span> <span class="toc-text">快照持久化</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#快照可用配置"><span class="toc-number">2.1.</span> <span class="toc-text">快照可用配置</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#RDB文件结构"><span class="toc-number">2.2.</span> <span class="toc-text">RDB文件结构</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#创建快照"><span class="toc-number">2.3.</span> <span class="toc-text">创建快照</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#快照优缺点"><span class="toc-number">2.4.</span> <span class="toc-text">快照优缺点</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#参考文档"><span class="toc-number">3.</span> <span class="toc-text">参考文档</span></a></li></ol>
                </div>
            
            <blockquote>
<p>恩，先说点题外话。上周被小虐了一丢丢,但有很大收获,了解了自己的不足,知道了自己还在哪些方面有欠缺。更坚定了一直以来的想法,应届生或者工作时间不长的人找工作公司规模，福利薪资都是浮云，跟对人才是最重要的,非常及其以及特别的重要,一个人好技术牛的部门leader绝对抵得上5K的薪资。这也完美解释了为何部门拆分,老大和磊哥走了之后这么不舒服,这尼玛相当于给我减了5K的工资啊,扯远了。。。。还是来看Redis吧，整理下Redis持久化的相关内容，加深下印象。不想看文字的可直接看下面的图😂。</p>
</blockquote>
<a id="more"></a>
<p><img src="https://pic.yupoo.com/jiananshi/b327bfb1/c3d25535.png" alt="概要"></p>
<h3 id="AOF持久化"><a href="#AOF持久化" class="headerlink" title="AOF持久化"></a>AOF持久化</h3><p>AOF(append-only file只追加文件)持久化会将执行的写命令追加到AOF文件的末尾。在恢复数据时，只要从头到尾的执行AOF文件中包含的所有写命令即可</p>
<h4 id="AOF可用配置"><a href="#AOF可用配置" class="headerlink" title="AOF可用配置"></a>AOF可用配置</h4><table>
<thead>
<tr>
<th>配置项</th>
<th>含义</th>
<th>可选值 </th>
</tr>
</thead>
<tbody>
<tr>
<td>appendonly</td>
<td>是否开启AOF持久化</td>
<td>no,yes </td>
</tr>
<tr>
<td>appendfsync</td>
<td>将写命令同步到硬盘的间隔</td>
<td>everysec,always,no</td>
</tr>
<tr>
<td>no-appendfsync-on-rewrite</td>
<td>对文件进行压缩时能否执行同步操作</td>
<td>no,yes</td>
</tr>
<tr>
<td>auto-aof-rewrite-percentage</td>
<td>当前文件大小是上一次压缩后AOF文件大小的多少时执行自动压缩</td>
<td></td>
</tr>
<tr>
<td>auto-aof-rewrite-min-size</td>
<td>当前文件大小是多少时执行自动压缩</td>
</tr>
<tr>
<td>dir path/to/appendonly.aof</td>
<td>文件存放位置</td>
</tr>
</tbody>
</table>
<p>其实主要的就是appendfsync配置项，有三个可选值，<code>always</code>(每次执行写操作都要同步写入硬盘),<code>everysec</code>(每秒执行一次同步),<code>no</code>(让系统决定何时执行同步)。虽然选择<code>always</code>可将数据丢失减少到最少，但这种策略会对硬盘进行大量的写入操作，处理命令速度受到硬盘限制。建议选择<code>everysec</code>。</p>
<h4 id="AOF优缺点"><a href="#AOF优缺点" class="headerlink" title="AOF优缺点"></a>AOF优缺点</h4><p>优点：</p>
<ul>
<li>比快照方式可靠，默认每秒同步一次，意味着最多丢失一秒的数据</li>
</ul>
<p>缺点：</p>
<ul>
<li>相同数据集大小，AOF文件会比快照文件大</li>
</ul>
<h4 id="AOF文件格式"><a href="#AOF文件格式" class="headerlink" title="AOF文件格式"></a>AOF文件格式</h4><p>一开始以为Redis就是将写命令原封不动的存储到AOF文件中，自己试了一下才知道，AOF文件是使用Redis网络通讯协议的格式来保存这些命令。<br>举个🌰：<br><figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">127.0.0.1:6379&gt; <span class="built_in">set</span> number 21</div><div class="line">OK</div></pre></td></tr></table></figure></p>
<p>将上面的命令存储到AOF文件就是下面的样子（select 0命令是代表选择id为0的数据库）：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div></pre></td><td class="code"><pre><div class="line">*2</div><div class="line"><span class="variable">$6</span></div><div class="line">SELECT</div><div class="line"><span class="variable">$1</span></div><div class="line">0</div><div class="line">*3</div><div class="line"><span class="variable">$3</span></div><div class="line">SET</div><div class="line"><span class="variable">$6</span></div><div class="line">number</div><div class="line"><span class="variable">$2</span></div><div class="line">21</div></pre></td></tr></table></figure>
<p>来看下AOF文件的格式，了解它的格式可以让我们很容易的解析它，指不定哪天能用到啊🌝。*号代表命令参数的个数(在上面的例子中参数为set、number、21,共3个)，$号代表第N个参数的长度，在上面的例子中，三个参数的长度分别为3，6，2。</p>
<h4 id="压缩AOF文件"><a href="#压缩AOF文件" class="headerlink" title="压缩AOF文件"></a>压缩AOF文件</h4><p>Redis可以自动压缩(也可以叫重写)AOF文件，用户也可以通过<code>BGREWRITEAOF</code>命令来压缩AOF文件。这里的压缩，不是平时说的压缩的意思，是指创建一个新的文件来替换旧的文件，两个文件保存的数据状态完全一致。如果在本地手动执行<code>BGREWRITEAOF</code>命令，可以看到会生成一个temp-rewriteaof-*.aof的临时文件，在结束后替换appendonly.aof文件，从而减小appendonly.aof文件的大小。我知道这样说其实还是不好理解，还是上图吧。为了方便画图，我就默默假装Redis直接将命令按输入的样子存储到AOF文件中，不要拆穿我🙈。<br>假设执行的写命令是下面的样子：<br><img src="https://pic.yupoo.com/jiananshi/5ffcfc72/e0b6e067.png" alt="执行的写操作"><br>那么看看在压缩前AOF文件的样子(就是存储了除get命令外的所有写命令)：<br><img src="https://pic.yupoo.com/jiananshi/192f9551/e0069359.png" alt="压缩前的AOF文件"><br>接着执行BGREWRITEAOF命令，Redis会生成一个新的文件来替换旧的AOF文件，从而达到压缩的目的：<br><img src="https://pic.yupoo.com/jiananshi/75e5cafb/ff3f282b.png" alt="压缩后的AOF文件"></p>
<p>可以看到压缩前文件中存储了7条写命令，压缩后只存储一条。而且执行set number 1和6次incr number命令 ，与执行set number 7命令效果是一样的。从而即保证了数据的正确性又压缩了文件的大小。</p>
<blockquote>
<p>需要注意的是，Redis是启用子进程来进行AOF文件的压缩，在这期间主进程还是可以继续处理请求的，如果这时请求有写操作就可能导致当前数据库与压缩后的AOF不一致。Redis增加了一个缓存来解决这个问题，主进程在接收到新的写操作命令之后，会将命令写入现有的AOF文件和缓存中。在子进程完成新的AOF文件之后会将缓存的内容写入到新的AOF文件中，并改名覆盖旧的AOF文件。</p>
</blockquote>
<h3 id="快照持久化"><a href="#快照持久化" class="headerlink" title="快照持久化"></a>快照持久化</h3><h4 id="快照可用配置"><a href="#快照可用配置" class="headerlink" title="快照可用配置"></a>快照可用配置</h4><table>
<thead>
<tr>
<th>配置项</th>
<th>含义</th>
<th>可选值 </th>
</tr>
</thead>
<tbody>
<tr>
<td>save m n</td>
<td>m秒内有n次写入时创建快照</td>
<td></td>
</tr>
<tr>
<td>stop-writes-on-bgsave-error</td>
<td>创建快照失败后是否继续执行写命令</td>
<td>no,yes</td>
</tr>
<tr>
<td>rdbcomression</td>
<td>是否压缩快照文件</td>
<td>no,yes</td>
</tr>
<tr>
<td>dbfilename</td>
<td>命名快照文件</td>
<td></td>
</tr>
<tr>
<td>dir path/to/dump.rdb</td>
<td>文件存放位置</td>
</tr>
</tbody>
</table>
<h4 id="RDB文件结构"><a href="#RDB文件结构" class="headerlink" title="RDB文件结构"></a>RDB文件结构</h4><p>RDB文件是一个经过压缩的二进制文件，不同类型的键值对会采用不同的方式来保存它们。具体的结构我也还没理清楚。。可以参考这篇文章<a href="http://redisbook.com/preview/rdb/rdb_struct.html" target="_blank" rel="external">http://redisbook.com/preview/rdb/rdb_struct.html</a></p>
<h4 id="创建快照"><a href="#创建快照" class="headerlink" title="创建快照"></a>创建快照</h4><p>创建快照的方式有以下几种：</p>
<ul>
<li>客户端发送<code>BGSAVE</code>命令。与压缩AOF文件一样，Redis会fork出一个子进程，由子进程负责将快照写入硬盘。</li>
<li>客户端发送<code>SAVE</code>命令。Redis会开始创建快照，并且在快照创建完成之前不再处理其他命令。不常使用<code>SAVE</code>命令</li>
<li>在满足配置的save m n选项时。比如，配置了save 60 1000,会在满足60秒内有1000次写入的时候开始创建快照。</li>
<li>当接收到<code>SHUTDOWN</code>请求时，Redis会执行<code>SAVE</code>命令,并且不再执行任何其他命令。</li>
<li>当从服务器向主服务器发送SYNC命令时，如果主服务器不是刚刚执行过<code>BGSAVE</code>命令,就会开始执行<code>BGSAVE</code>来创建快照。</li>
</ul>
<h4 id="快照优缺点"><a href="#快照优缺点" class="headerlink" title="快照优缺点"></a>快照优缺点</h4><p>优点：</p>
<ul>
<li>文件紧凑,适用于做不同版本的数据备份</li>
<li>与AOF相比在恢复大数据集时，更快</li>
<li>很方便传送到另一个数据中心</li>
</ul>
<p>缺点：</p>
<ul>
<li>一旦Redis出现问题，上一次创建快照之后的数据就丢失了</li>
</ul>
<h3 id="参考文档"><a href="#参考文档" class="headerlink" title="参考文档"></a>参考文档</h3><p>《Redis In Action》<br><a href="http://www.redis.cn/topics/persistence.html" target="_blank" rel="external">http://www.redis.cn/topics/persistence.html</a><br><a href="http://redisbook.readthedocs.org/en/latest/internal/aof.html" target="_blank" rel="external">http://redisbook.readthedocs.org/en/latest/internal/aof.html</a></p>

        
        </div>
        <footer class="article-footer">
            <div class="share-container">



</div>

    <a data-url="http://yemengying.com/2016/04/24/Redis-Persistence/" data-id="cjtvbuch00008z15sfvcr76i2" class="article-share-link"><i class="fa fa-share"></i>分享到</a>
<script>
    (function ($) {
        // Prevent duplicate binding
        if (typeof(__SHARE_BUTTON_BINDED__) === 'undefined' || !__SHARE_BUTTON_BINDED__) {
            __SHARE_BUTTON_BINDED__ = true;
        } else {
            return;
        }
        $('body').on('click', function() {
            $('.article-share-box.on').removeClass('on');
        }).on('click', '.article-share-link', function(e) {
            e.stopPropagation();

            var $this = $(this),
                url = $this.attr('data-url'),
                encodedUrl = encodeURIComponent(url),
                id = 'article-share-box-' + $this.attr('data-id'),
                offset = $this.offset(),
                box;

            if ($('#' + id).length) {
                box = $('#' + id);

                if (box.hasClass('on')){
                    box.removeClass('on');
                    return;
                }
            } else {
                var html = [
                    '<div id="' + id + '" class="article-share-box">',
                        '<input class="article-share-input" value="' + url + '">',
                        '<div class="article-share-links">',
                            '<a href="https://twitter.com/intent/tweet?url=' + encodedUrl + '" class="fa fa-twitter article-share-twitter" target="_blank" title="Twitter"></a>',
                            '<a href="https://www.facebook.com/sharer.php?u=' + encodedUrl + '" class="fa fa-facebook article-share-facebook" target="_blank" title="Facebook"></a>',
                            '<a href="http://pinterest.com/pin/create/button/?url=' + encodedUrl + '" class="fa fa-pinterest article-share-pinterest" target="_blank" title="Pinterest"></a>',
                            '<a href="https://plus.google.com/share?url=' + encodedUrl + '" class="fa fa-google article-share-google" target="_blank" title="Google+"></a>',
                        '</div>',
                    '</div>'
                ].join('');

              box = $(html);

              $('body').append(box);
            }

            $('.article-share-box.on').hide();

            box.css({
                top: offset.top + 25,
                left: offset.left
            }).addClass('on');

        }).on('click', '.article-share-box', function (e) {
            e.stopPropagation();
        }).on('click', '.article-share-box-input', function () {
            $(this).select();
        }).on('click', '.article-share-box-link', function (e) {
            e.preventDefault();
            e.stopPropagation();

            window.open(this.href, 'article-share-box-window-' + Date.now(), 'width=500,height=450');
        });
    })(jQuery);
</script>

            
    
        <a href="http://yemengying.com/2016/04/24/Redis-Persistence/#comments" class="article-comment-link disqus-comment-count" data-disqus-url="http://yemengying.com/2016/04/24/Redis-Persistence/">评论</a>
    

        </footer>
    </div>
    
        
<nav id="article-nav">
    
        <a href="/2016/04/24/good-website/" id="article-nav-newer" class="article-nav-link-wrap">
            <strong class="article-nav-caption">上一篇</strong>
            <div class="article-nav-title">
                
                    觉得还不错的网站
                
            </div>
        </a>
    
    
        <a href="/2016/04/02/take-advantage-of-Redis/" id="article-nav-older" class="article-nav-link-wrap">
            <strong class="article-nav-caption">下一篇</strong>
            <div class="article-nav-title">Redis相关---【译】利用Redis起飞吧</div>
        </a>
    
</nav>


    
    <script>
   DisqusJS.getArticleComments();
   </script>
</article>


    
    <section id="comments">
    
        
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>

    
    </section>

</section>
            
        </div>
        <footer id="footer">
    <div class="outer">
        <div id="footer-info" class="inner">
            &copy; 2019 Mengying Ye<br>
            Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
        </div>
    </div>
</footer>
        
    
   <script>
   DisqusJS.getRecentComments(document.querySelector('#disqus-recent-comments'));
   </script>



    
        <script src="/lib/fancybox/jquery.fancybox.pack.js"></script>
    


<!-- Custom Scripts -->
<script src="/js/main.js"></script>

    </div>
</body>
</html>
